<template>
  <div class="my">
    <div class="top">
      <div class="myinfo">
        <div class="picture" @click="$router.push('/personalInfo')">
          <img :src="user.photo" alt="" />
        </div>
        <div class="message">
          <div class="name">{{ user.name }}</div>
          <div class="vip">申请认证</div>
        </div>
        <div class="readtime">
          <div class="readpic">
            <img src="../../../assets/yudu.png" alt="" />
          </div>
          <div>
            <div class="txt">今日阅读</div>
            <div class="txt">5分钟</div>
          </div>
        </div>
      </div>
      <div class="other">
        <div>
          <div>{{ user.art_count }}</div>
          <div class="txt" @click="toproduction(0)">动态</div>
        </div>
        <div>
          <div>{{ follow.length }}</div>
          <div class="txt" @click="tofollow(0)">关注</div>
        </div>
        <div>
          <div>{{ user.fans_count }}</div>
          <div class="txt" @click="tofollow(1)">粉丝</div>
        </div>
      </div>
    </div>
    <div class="middle">
      <div @click="tocollect(0)">
        <div class=" myicon color1"><van-icon name="star-o" /></div>
        <div class="txt">收藏</div>
      </div>
      <div @click="tocollect(1)">
        <div class=" myicon color2"><van-icon name="clock-o" /></div>
        <div class="txt">历史</div>
      </div>
      <div @click="toproduction(0)">
        <div class=" myicon color3"><van-icon name="records" /></div>
        <div class="txt">作品</div>
      </div>
    </div>
    <div class="content">
      <van-cell is-link @click="toinformation">
        <template #title>
          <span>消息通知</span>
        </template>
      </van-cell>
      <van-cell is-link>
        <template #title>
          <span>实名认证</span>
        </template>
      </van-cell>
    </div>
    <div class="content">
      <van-cell is-link>
        <template #title>
          <span>用户反馈</span>
        </template>
      </van-cell>
      <van-cell is-link>
        <template #title>
          <span>小智同学</span>
        </template>
      </van-cell>
      <van-cell is-link>
        <template #title>
          <span>系统设置</span>
        </template>
      </van-cell>
    </div>
  </div>
</template>
<script>
import { getUserPersonalInfo, getUserFollowList } from '../../../api/user'
export default {
  data () {
    return {
      // 用户信息
      user: {},
      // 关注信息
      follow: []
    }
  },
  methods: {
    // 跳转到关注页面
    tofollow (active) {
      this.$router.push(`/follow/${active}`)
    },
    // 跳转到收藏/历史页面
    tocollect (active) {
      this.$router.push(`/collect/${active}`)
    },
    // 跳转到作品页面
    toproduction (active) {
      this.$router.push(`/production/${active}`)
    },
    // 跳转到消息通知页面
    toinformation () {
      this.$router.push('/infomation')
    }
  },
  async created () {
    const res = await getUserPersonalInfo()
    this.user = res.data.data
    const res2 = await getUserFollowList()
    this.follow = res2.data.data.results
  }
}
</script>
<style lang="less" scoped>
.my {
  //   padding-left: 21px;
  font-size: 18px;
  height: 100vh;
  background-color: #f5f7f9;

  .top {
    height: 202px;
    padding-left: 21px;
    background-color: #449ffa;
    border: 1px solid transparent;
    .myinfo {
      position: relative;
      margin-top: 60px;
      display: flex;
      align-items: center;
      .picture {
        // overflow: hidden;
        img {
          width: 66px;
          height: 66px;
          border-radius: 50%;
        }
      }
      .message {
        margin-left: 15px;
        .name {
          font-size: 15px;
          color: #fff;
        }
        .vip {
          width: 58px;
          height: 16px;
          line-height: 16px;
          background-color: #fff;
          border-radius: 8px;
          text-align: center;
          margin-top: 12px;
          font-size: 10px;
          color: #3296fa;
        }
      }
      .readtime {
        position: absolute;
        right: 0px;
        top: 10px;
        display: flex;
        font-size: 12px;
        padding-top: 10px;
        border-top-left-radius: 25px;
        border-bottom-left-radius: 25px;
        background-color: #3880c8;
        box-sizing: content-box;
        .txt {
          margin-left: 5px;
        }
        .readpic {
          width: 40px;
          height: 40px;
          line-height: 40px;
          text-align: center;
          img {
            width: 16px;
            height: 16px;
          }
        }
      }
    }
    .other {
      color: #fff;
      text-align: center;
      margin-top: 20px;
      display: flex;
      justify-content: space-around;
      .txt {
        margin-top: 5px;
        font-size: 12px;
      }
    }
  }
  .middle {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin-top: 10px;
    height: 66px;
    background-color: #fff;
    .myicon {
      margin-top: 8px;
      font-size: 30px;
    }
    .txt {
      font-size: 14px;
    }
    .color1 {
      color: #eb5253;
    }
    .color2 {
      color: #ff9d1d;
    }
    .color3 {
      color: #678eff;
    }
  }
  .content {
    margin-top: 5px;
    span {
      font-size: 16px;
      color: #333333;
    }
  }
}
</style>
